VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmChangePassword 
   BackColor       =   &H00800000&
   Caption         =   " "
   ClientHeight    =   3195
   ClientLeft      =   3945
   ClientTop       =   2370
   ClientWidth     =   4890
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   3195
   ScaleWidth      =   4890
   Begin VB.CommandButton cmdExit 
      Caption         =   "&Exit"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   345
      Left            =   1725
      TabIndex        =   10
      Top             =   2805
      Width           =   1155
   End
   Begin VB.PictureBox SSPanel1 
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   0  'None
      Height          =   1950
      Left            =   330
      ScaleHeight     =   1950
      ScaleWidth      =   4395
      TabIndex        =   0
      Top             =   705
      Width           =   4395
      Begin VB.TextBox oldpsw 
         Height          =   330
         IMEMode         =   3  'DISABLE
         Left            =   2295
         PasswordChar    =   "*"
         TabIndex        =   3
         Top             =   810
         Width           =   1635
      End
      Begin VB.TextBox newpsw2 
         Height          =   330
         IMEMode         =   3  'DISABLE
         Left            =   2295
         PasswordChar    =   "*"
         TabIndex        =   2
         Top             =   1365
         Width           =   1635
      End
      Begin VB.TextBox newpsw1 
         Height          =   330
         IMEMode         =   3  'DISABLE
         Left            =   2295
         PasswordChar    =   "*"
         TabIndex        =   1
         Top             =   825
         Width           =   1635
      End
      Begin VB.Label lbpswold 
         BackStyle       =   0  'Transparent
         Caption         =   "old Password"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   300
         Left            =   795
         TabIndex        =   8
         Top             =   795
         Width           =   1335
      End
      Begin VB.Label lbpswnew1 
         BackStyle       =   0  'Transparent
         Caption         =   "New Password "
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   360
         Left            =   675
         TabIndex        =   7
         Top             =   780
         Width           =   1455
      End
      Begin VB.Label lbpswnew2 
         BackStyle       =   0  'Transparent
         Caption         =   "New Password  again"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   405
         Left            =   60
         TabIndex        =   6
         Top             =   1350
         Width           =   2205
      End
      Begin VB.Label lbl 
         BackColor       =   &H8000000D&
         BackStyle       =   0  'Transparent
         Caption         =   "User name"
         BeginProperty Font 
            Name            =   "Verdana"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   345
         Left            =   990
         TabIndex        =   5
         Top             =   330
         Width           =   1095
      End
      Begin VB.Label UserName 
         Alignment       =   2  'Center
         BackColor       =   &H80000016&
         DataField       =   "user"
         DataSource      =   "Adodc1"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   2295
         TabIndex        =   4
         Top             =   315
         Width           =   1650
      End
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   2940
      Top             =   465
      Visible         =   0   'False
      Width           =   1785
      _ExtentX        =   3149
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label Label1 
      BackColor       =   &H80000016&
      BackStyle       =   0  'Transparent
      Caption         =   "Change Password"
      BeginProperty Font 
         Name            =   "VNI-Present"
         Size            =   15.75
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00E0E0E0&
      Height          =   465
      Left            =   30
      TabIndex        =   9
      Top             =   0
      Width           =   2925
   End
End
Attribute VB_Name = "frmChangePassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Form_Activate()
UserName.Caption = UserLogin
Adodc1.ConnectionString = ConnectString
Adodc1.CommandTimeout = 10
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "Select Users.* from Users where (((Users.UserName) ='" & UserLogin & "'))"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
End Sub

Private Sub Form_Load()
    lbpswnew1.Visible = False
    lbpswnew2.Visible = False
    newpsw1.Visible = False
    newpsw2.Visible = False
End Sub

Private Sub newpsw1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then
        lbpswnew2.Visible = True
        newpsw2.Visible = True
        newpsw2.SetFocus
End If

End Sub


Private Sub newpsw2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If newpsw2.Text = newpsw1.Text Then
        Set cmdExecute = New ADODB.Command
        Set cmdExecute.ActiveConnection = DBconn
        cmdExecute.CommandText = ("UPDATE Users SET " & _
            " password ='" & encode(newpsw2.Text) & "'" & _
            " WHERE username='" & UserName.Caption & "'")
        cmdExecute.Execute
        MsgBox "Password has been changed !"
        Unload frmChangePassword
    Else
        MsgBox "Wrong Password. Please input again"
        newpsw1.SetFocus
        newpsw1.Text = ""
        newpsw2.Text = ""
    End If
End If
End Sub


Private Sub ok_Click()
End Sub

Private Sub oldpsw_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    With Adodc1.Recordset
        .MoveFirst
        Do Until !UserName = UserName.Caption
            .MoveNext
        Loop
    End With
    If encode(oldpsw.Text) = Adodc1.Recordset("password") Then
        lbpswold.Visible = False
        oldpsw.Visible = False
        lbpswnew1.Visible = True
        newpsw1.Visible = True
        newpsw1.SetFocus
    Else
        MsgBox "Wrong Old Password. Please Re-input!"
        oldpsw.SetFocus
    End If
End If

End Sub


Private Sub cmdExit_Click()
    Unload frmChangePassword
End Sub






